home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 4 / Amoszine 4 (Disk 1 of 3).adf / READERS_SOURCE.LHA / READERS_SOURCE / PRO_S.PULLINGER / Phone_Numbers.Amos / Phone_Numbers.amosSourceCode
Encoding:
AMOS Source Code  |  1992-02-26  |  16.5 KB  |  705 lines

  1. ' Phone_numbers.Amos - Sept. 94
  2.  
  3. ' Steve Pullinger
  4.  
  5. ' This needs AMOSPro!! 
  6.  
  7. ' This is a simple database for phone numbers allowing a search
  8. ' by name. 
  9.  
  10. ' The actual data handling is very simple, the bulk of the code
  11. ' is for the Interface requesters. 
  12.  
  13. ' Notice that most of the variables used in the program are locally shared 
  14. ' between the procedures that have authority to modify them. 
  15.  
  16. ' Set Up 
  17. ' ====== 
  18. Dir$="Pro_Progs1:Programs/Interface" : Rem Replace this with your own path
  19.  
  20. ' Global Constants 
  21. ' ================ 
  22. Global MX_RECORDS
  23.  
  24. MX_RECORDS=30
  25.  
  26. ' Global Variables 
  27. ' ================ 
  28. Global MARK_END
  29.  
  30. MARK_END=0
  31.  
  32. ' Shared Variables 
  33. ' ================ 
  34. Dim NAME$(MX_RECORDS),NUMBER$(MX_RECORDS)
  35. CHANGE_DATA=False
  36.  
  37. INITIALISE
  38.  
  39. ' Main Program Loop
  40. ' =================
  41. MENU
  42. Cls 0
  43. TERMINATE
  44.  
  45. ' Procedure Definitions
  46. ' =====================
  47. Procedure MENU
  48.    ' This procedure displays a menu of options for a phone number 
  49.    ' database 
  50.    
  51.    ' Interface Program
  52.    A$=""
  53.    A$=A$+"BAse     123,20 ;"
  54.    A$=A$+"SIze     384,160 ;"
  55.    A$=A$+"SAve     1 ;"
  56.    A$=A$+"BOx      0,0,67,384,160 ;"
  57.    
  58.    ' Program Name     
  59.    A$=A$+"LIne     48,24,31,336 ;"
  60.    A$=A$+"POutline 1VACentreX,10,1VA,0,3 ;"
  61.    A$=A$+"LIne     48,40,31,336 ;"
  62.    
  63.    ' Menu Title 
  64.    A$=A$+"POutline 2VACentreX,30,2VA,0,3 ;"
  65.    
  66.    ' Browse Option
  67.    A$=A$+"BUtton   1,48,50,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 3VACentreXBP+,4,3VA,0,3;][ButtonReturn 0;]KY 66,0;"
  68.    
  69.    ' Add Record 
  70.    A$=A$+"BUtton   2,48,70,288,16,0,0,1; [LI 0,0,BP3*88+,288;PO 4VACentreXBP+,4,4VA,0,3;][ButtonReturn 0;]KY 65,0;"
  71.    
  72.    ' Delete Record  
  73.    A$=A$+"BUtton   3,48,90,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 5VACentreXBP+,4,5VA,0,3;][ButtonReturn 0;]KY 68,0;"
  74.    
  75.    ' Search 
  76.    A$=A$+"BUtton   4,48,110,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 6VACentreXBP+,4,6VA,0,3;][ButtonReturn 0;]KY 83,0;"
  77.    
  78.    ' Quit 
  79.    A$=A$+"BUtton   5,48,130,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 7VACentreXBP+,4,7VA,0,3;][ButtonReturn 0;]KY 81,0;"
  80.    
  81.    ' End of Interface Program   
  82.    'A$=A$+"RUn      0,0;" 
  83.    A$=A$+"EXit ;"
  84.    
  85.    
  86.    ' Open Communication Channel between Amos and Interface program
  87.    Dialog Open 2,A$
  88.    
  89.    Gosub VARS
  90.    
  91.    ' Call Interface Program 
  92.    X=Dialog Run(2)
  93.    
  94.    Repeat 
  95.       SELECTED=Dialog(2)
  96.       Dialog Freeze 2
  97.       
  98.       ' Call Chosen Option 
  99.       ' ================== 
  100.       If SELECTED=1
  101.          If MARK_END=0
  102.             MESSAGE["No Records to Browse!",100]
  103.          Else 
  104.             
  105.             BROWSE
  106.          End If 
  107.       End If 
  108.       
  109.       If SELECTED=2
  110.          If MARK_END>=MX_RECORDS
  111.             MESSAGE["Database Is Full!!",100]
  112.          Else 
  113.             Inc MARK_END
  114.             AD_RECORD["","",MARK_END]
  115.             Gosub VARS
  116.             X=Dialog Run(2)
  117.          End If 
  118.       End If 
  119.       
  120.       If SELECTED=3
  121.          DELETE_RECORD
  122.          Gosub VARS
  123.          X=Dialog Run(2)
  124.       End If 
  125.       
  126.       If SELECTED=4
  127.          SEARCH
  128.          Gosub VARS
  129.       End If 
  130.       
  131.       Dialog Unfreeze 2
  132.    Until SELECTED=5
  133.    
  134.    ' Close Interface program
  135.    Dialog Close(2)
  136.    Pop Proc
  137.    
  138.    VARS:
  139.    ' Send defaults to Interface 
  140.    Vdialog$(2,1)="Steve's Phone Numbers"
  141.    If MARK_END=1
  142.       R$=" Record"
  143.    Else 
  144.       R$=" Records"
  145.    End If 
  146.    Vdialog$(2,2)=Str$(MARK_END)+R$+" in Memory"
  147.    Vdialog$(2,3)="Browse Through Records"
  148.    Vdialog$(2,4)="Add One Record"
  149.    Vdialog$(2,5)="Delete Records"
  150.    Vdialog$(2,6)="Search"
  151.    Vdialog$(2,7)="Quit"
  152.    Return 
  153.    
  154. End Proc
  155.  
  156. Procedure INITIALISE
  157.    Shared NAME$(),NUMBER$()
  158.    
  159.    ' Initialise Interface resources 
  160.    Load "AMOSPro_System:APSystem/AMOSPro_Default_resource.abk"
  161.    Resource Bank 16
  162.    Resource Screen Open 0,640,200,0
  163.    Flash Off : Curs Off : Cls 0 : Paper 0 : Pen 7
  164.    Wait Vbl 
  165.    
  166.    ' Check for existing data file 
  167.    ' ============================ 
  168.    If Exist("Phone.dat")
  169.       ' Load Data
  170.       ' =========
  171.       Open Random 1,"Phone.dat"
  172.       Field 1,50 As IN_NAME$,20 As IN_NUM$
  173.       Get 1,1
  174.       MARK_END=Val(IN_NUM$)
  175.       
  176.       ' Read until end of file 
  177.       ' ====================== 
  178.       For RECORD=2 To MARK_END+1
  179.          Get 1,RECORD
  180.          NAME$(RECORD-1)=IN_NAME$
  181.          NUMBER$(RECORD-1)=IN_NUM$
  182.       Next RECORD
  183.       
  184.       Close 1
  185.       
  186.    End If 
  187.    
  188. End Proc
  189.  
  190. Procedure BROWSE
  191.    Shared NAME$(),NUMBER$()
  192.    
  193.    ' Interface Program
  194.    A$=""
  195.    A$=A$+"BAse     80,30 ;"
  196.    A$=A$+"SIze     384,120 ;"
  197.    A$=A$+"SAve     1 ;"
  198.    A$=A$+"BOx      0,0,67,384,120 ;"
  199.    
  200.    ' Title    
  201.    A$=A$+"LIne     48,24,31,336 ;"
  202.    A$=A$+"POutline 7VACentreX,10,7VA,0,3 ;"
  203.    A$=A$+"LIne     48,40,31,336 ;"
  204.    
  205.    ' Record Number
  206.    A$=A$+"POutline 8VACentreX,30,8VA,0,3 ;"
  207.    
  208.    ' Display Name 
  209.    A$=A$+"POutline 18,50,5VA,0,3 ;"
  210.    
  211.    ' Display Number 
  212.    A$=A$+"POutline 18,70,6VA,0,3 ;"
  213.    
  214.    ' Previous Option
  215.    A$=A$+"BUtton   1,48,90,48,16,0,0,1;[LI 0,0,BP3*88+,48;PO 8BP+,4,1VA,0,3;][ButtonReturn 0;]KY 80,0;"
  216.    
  217.    ' Next Option
  218.    A$=A$+"BUtton   2,108,90,48,16,0,0,1;[LI 0,0,BP3*88+,48;PO 6BP+,4,2VA,0,3;][ButtonReturn 0;]KY 78,0;"
  219.    
  220.    ' Edit Option
  221.    A$=A$+"BUtton   3,238,90,48,16,0,0,1;[LI 0,0,BP3*88+,48;PO 3BP+,4,3VA,0,3;][ButtonReturn 0;]KY 69,0;"
  222.    
  223.    ' Ok Option
  224.    A$=A$+"BUtton   4,292,90,48,16,0,0,1;[LI 0,0,BP3*88+,48;PO 4BP+,4,4VA,0,3;][ButtonReturn 0;]KY 79,0;"
  225.    
  226.    
  227.    ' End of Interface Program   
  228.    A$=A$+"EXit ;"
  229.    
  230.    ' Open Communication Channel between Amos and Interface program
  231.    Dialog Open 3,A$
  232.    REC_NO=1
  233.    Gosub VARS
  234.    
  235.    ' Call Interface Program 
  236.    X=Dialog Run(3)
  237.    
  238.    ' Check Option 
  239.    Repeat 
  240.       SELECTED=Dialog(3)
  241.       
  242.       If SELECTED=1
  243.          ' Previous 
  244.          If REC_NO>1
  245.             
  246.             Dec REC_NO
  247.             Dialog Freeze 3
  248.             Gosub VARS
  249.             X=Dialog Run(3)
  250.          End If 
  251.       End If 
  252.       
  253.       If SELECTED=2
  254.          ' Next 
  255.          If REC_NO<MARK_END
  256.             Inc REC_NO
  257.             Dialog Freeze 3
  258.             Gosub VARS
  259.             X=Dialog Run(3)
  260.          End If 
  261.       End If 
  262.       
  263.       If SELECTED=3
  264.          ' Edit Record
  265.          Dialog Freeze 3
  266.          Dialog Clr 3
  267.          
  268.          AD_RECORD[NAME$(REC_NO),NUMBER$(REC_NO),REC_NO]
  269.          Gosub VARS
  270.          X=Dialog Run(3)
  271.       End If 
  272.       
  273.    Until SELECTED=4
  274.    
  275.    ' Close Interface program
  276.    Dialog Close(3)
  277.    
  278.    Pop Proc
  279.    
  280.    VARS:
  281.    ' Send defaults to Interface 
  282.    Vdialog$(3,1)="Prev"
  283.    Vdialog$(3,2)="Next"
  284.    Vdialog$(3,3)="Edit"
  285.    Vdialog$(3,4)=" Ok "
  286.    Vdialog$(3,5)="Name: "+NAME$(REC_NO)
  287.    Vdialog$(3,6)="Tel: "+NUMBER$(REC_NO)
  288.    Vdialog$(3,7)="Browse Records"
  289.    Vdialog$(3,8)="Current Record:"+Str$(REC_NO)
  290.    Return 
  291.    
  292. End Proc
  293.  
  294. Procedure AD_RECORD[DEF_NAME$,DEF_NUM$,REC_NO]
  295.    Shared NAME$(),NUMBER$(),TEMP_NAME$,TEMP_NUM$,CHANGE_DATA
  296.    
  297.    RECORD_REQUESTER[DEF_NAME$,DEF_NUM$,"Record No:"+Str$(REC_NO)]
  298.    
  299.    CHANGE_DATA=True
  300.    Repeat 
  301.       
  302.       If TEMP_NAME$=""
  303.          RECORD_REQUESTER["",TEMP_NUM$,"Please Enter Name for Record No:"+Str$(REC_NO)]
  304.       End If 
  305.       
  306.       If TEMP_NUM$=""
  307.          RECORD_REQUESTER[TEMP_NAME$,"","Please Enter Number for Record No:"+Str$(REC_NO)]
  308.       End If 
  309.       
  310.       ' Validate string for numbers, spaces or hyphens only  
  311.       ' ===================================================
  312.       If TEMP_NUM$>""
  313.          F=1
  314.          _VALID=True
  315.          
  316.          Repeat 
  317.             CH$=Mid$(TEMP_NUM$,F,1)
  318.             
  319.             If((CH$<"0") or(CH$>"9")) and(CH$<>" ") and(CH$<>"-")
  320.                _VALID=False
  321.             End If 
  322.             
  323.             Inc F
  324.          Until F>Len(TEMP_NUM$)
  325.          
  326.          If Not _VALID
  327.             TEMP_NUM$=""
  328.          End If 
  329.          
  330.       End If 
  331.       
  332.    Until(TEMP_NAME$<>"") and(TEMP_NUM$<>"")
  333.    
  334.    NAME$(REC_NO)=TEMP_NAME$
  335.    NUMBER$(REC_NO)=TEMP_NUM$
  336.    
  337. End Proc
  338.  
  339. Procedure DELETE_RECORD
  340.    Shared CHANGE_DATA,NAME$(),NUMBER$()
  341.    
  342.    ' Ask Delete All, One Record, or Cancel
  343.    
  344.    ' Interface Program
  345.    A$=""
  346.    A$=A$+"BAse     123,20 ;"
  347.    A$=A$+"SIze     384,160 ;"
  348.    A$=A$+"SAve     1 ;"
  349.    A$=A$+"BOx      0,0,67,384,160 ;"
  350.    
  351.    
  352.    A$=A$+"SetVar   2,'Delete Records' ;"
  353.    A$=A$+"SetVar   3,'Delete ALL Records' ;"
  354.    A$=A$+"SetVar   4,'Delete ONE Record' ;"
  355.    A$=A$+"SetVar   5,'Cancel' ;"
  356.    
  357.    ' Menu Title 
  358.    A$=A$+"POutline 2VACentreX,30,2VA,0,3 ;"
  359.    
  360.    ' Delete All Option
  361.    A$=A$+"BUtton   1,48,50,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 3VACentreXBP+,4,3VA,0,3;][ButtonReturn 0;]KY 65,0;"
  362.    
  363.    ' Delete One Record  
  364.    A$=A$+"BUtton   2,48,70,288,16,0,0,1; [LI 0,0,BP3*88+,288;PO 4VACentreXBP+,4,4VA,0,3;][ButtonReturn 0;]KY 79,0;"
  365.    
  366.    ' Cancel   
  367.    A$=A$+"BUtton   3,48,90,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 5VACentreXBP+,4,5VA,0,3;][ButtonReturn 0;]KY 67,0;"
  368.    
  369.    ' End of Interface Program   
  370.    A$=A$+"EXit ;"
  371.    
  372.    ' Open Communication Channel 
  373.    Dialog Open 1,A$
  374.    
  375.    ' Call Interface Program 
  376.    X=Dialog Run(1)
  377.    
  378.    Repeat 
  379.       SELECTED=Dialog(1)
  380.       Dialog Freeze 1
  381.       
  382.       ' Delete All 
  383.       If SELECTED=1
  384.          CONFIRM_ACTION["This will erase ALL data, are you sure?"]
  385.          If Param=1
  386.             MARK_END=0
  387.             CHANGE_DATA=True
  388.             Vdialog$(2,2)=Str$(MARK_END)+" Records in Memory"
  389.          End If 
  390.       End If 
  391.       
  392.       ' Delete One Record
  393.       If SELECTED=2
  394.          T_REQUEST["Enter Record Number to delete"]
  395.          REC_NO=Val(Param$)
  396.          
  397.          If(REC_NO>0) and REC_NO<=MARK_END
  398.             SH0W_RECORD[NAME$(REC_NO),NUMBER$(REC_NO),"Record"+Str$(REC_NO)+" Selected for Deletion"]
  399.             CONFIRM_ACTION["Delete Record No."+Str$(REC_NO)+"?"]
  400.             
  401.             If Param=1
  402.                For COUNT=REC_NO To MARK_END-1
  403.                   NAME$(COUNT)=NAME$(COUNT+1)
  404.                   NUMBER$(COUNT)=NUMBER$(COUNT+1)
  405.                Next COUNT
  406.                Dec MARK_END
  407.                CHANGE_DATA=True
  408.             End If 
  409.             
  410.             Vdialog$(2,2)=Str$(MARK_END)+" Records in Memory"
  411.          End If 
  412.       End If 
  413.       
  414.       Dialog Unfreeze 1
  415.    Until SELECTED=3
  416.    
  417.    ' Close Interface program
  418.    Dialog Close(1)
  419.    
  420. End Proc
  421.  
  422. Procedure CONFIRM_ACTION[TITLE$]
  423.    ' Interface Program
  424.    A$=""
  425.    A$=A$+"BAse     80,20 ;"
  426.    A$=A$+"SIze     384,100 ;"
  427.    A$=A$+"SAve     1 ;"
  428.    A$=A$+"BOx      0,0,67,384,100 ;"
  429.    
  430.    A$=A$+"SetVar   3,'Yes, Continue' ;"
  431.    A$=A$+"SetVar   4,'NO, CANCEL!!' ;"
  432.    
  433.    ' Confirm Title  
  434.    A$=A$+"POutline 2VACentreX,30,2VA,0,3 ;"
  435.    
  436.    ' Yes Option 
  437.    A$=A$+"BUtton   1,48,50,288,16,0,0,1;[LI 0,0,BP3*88+,288;PO 3VACentreXBP+,4,3VA,0,3;][ButtonReturn 0;]KY 89,0;"
  438.    
  439.    ' NO Option  
  440.    A$=A$+"BUtton   2,48,70,288,16,0,0,1; [LI 0,0,BP3*88+,288;PO 4VACentreXBP+,4,4VA,0,3;][ButtonReturn 0;]KY 78,0;"
  441.    
  442.    
  443.    ' End of Interface Program   
  444.    'A$=A$+"RUn      0,0;" 
  445.    A$=A$+"EXit ;"
  446.    
  447.    ' Open Communication Channel 
  448.    Dialog Open 3,A$
  449.    
  450.    ' Set Variables
  451.    Vdialog$(3,2)=TITLE$
  452.    
  453.    ' Call Interface Program 
  454.    X=Dialog Run(3)
  455.    
  456.    Repeat 
  457.       SELECTED=Dialog(3)
  458.    Until(SELECTED=1) or(SELECTED=2)
  459.    
  460.    ' Close Interface program
  461.    Dialog Close(3)
  462.    
  463. End Proc[SELECTED]
  464.  
  465. Procedure RECORD_REQUESTER[DEF_NAME$,DEF_NUM$,TITLE$]
  466.    ' This procedure displays an Interface requester allowing input  
  467.    ' of a name and a phone number 
  468.    
  469.    Shared TEMP_NAME$,TEMP_NUM$
  470.    
  471.    ' Interface Program
  472.    A$=""
  473.    A$=A$+"BAse     160,50 ;"
  474.    A$=A$+"SIze     384,100 ;"
  475.    A$=A$+"SAve     1 ;"
  476.    A$=A$+"BOx      0,0,67,384,100 ;"
  477.    A$=A$+"SetVar   1,'Enter Record Details' ;"
  478.    A$=A$+"SetVar   2,'Name:' ;"
  479.    A$=A$+"SetVar   3,'Tel.:' ;"
  480.    
  481.    ' Title    
  482.    A$=A$+"LIne     48,24,31,336 ;"
  483.    A$=A$+"POutline 1VACentreX,10,1VA,0,3 ;"
  484.    A$=A$+"LIne     48,40,31,336 ;"
  485.    
  486.    ' Record Number
  487.    A$=A$+"POutline 6VACentreX,30,6VA,0,3 ;"
  488.    
  489.    ' Name Gadget
  490.    A$=A$+"POutline 18,50,2VA,0,3 ;"
  491.    A$=A$+"EDit     1,70,50,32,31,4VA,0,5 ;"
  492.    
  493.    ' Number Gadget
  494.    A$=A$+"POutline 18,70,3VA,0,3 ;"
  495.    A$=A$+"EDit     2,70,70,20,19,5VA,0,5 ;"
  496.    
  497.    A$=A$+"BUtton   3,346,80,32,16,0,0,1;[UN 0,0,16;][ButtonQuit;]"
  498.    
  499.    ' End of Interface Program   
  500.    A$=A$+"EXit ;"
  501.    
  502.    ' Open Communication Channel between Amos and Interface program
  503.    Dialog Open 1,A$
  504.    Dialog Clr 1
  505.    ' Send defaults to Interface 
  506.    Vdialog$(1,4)=DEF_NAME$
  507.    Vdialog$(1,5)=DEF_NUM$
  508.    Vdialog$(1,6)=TITLE$
  509.    
  510.    ' Call Interface Program 
  511.    X=Dialog Run(1)
  512.    
  513.    For GADGET=1 To 2
  514.       Repeat 
  515.          ' Store Gadgets in strings 
  516.          TEMP_NAME$=Rdialog$(1,1)
  517.          TEMP_NUM$=Rdialog$(1,2)
  518.          
  519.       Until Dialog(1)
  520.    Next GADGET
  521.    
  522.    ' Close Interface program
  523.    Dialog Close(1)
  524.    
  525. End Proc
  526.  
  527. Procedure SEARCH
  528.    Shared NAME$(),NUMBER$()
  529.    
  530.    ' Search Spec
  531.    ' ===========
  532.    T_REQUEST["Enter name to search for"]
  533.    FIND$=Param$
  534.    
  535.    If FIND$>""
  536.       
  537.       ' Search array 
  538.       ' ============ 
  539.       NO_FOUND=0
  540.       For RECORD=1 To MARK_END
  541.          
  542.          If Instr(Left$(Upper$(NAME$(RECORD)),Len(FIND$)),Upper$(FIND$))
  543.             SH0W_RECORD[NAME$(RECORD),NUMBER$(RECORD),"Record No"+Str$(RECORD)]
  544.             Inc NO_FOUND
  545.          End If 
  546.          
  547.       Next RECORD
  548.       
  549.       If NO_FOUND=0
  550.          MESSAGE["No Match Found!",100]
  551.       Else 
  552.          MESSAGE["Search Complete",100]
  553.       End If 
  554.    End If 
  555.    
  556. End Proc
  557.  
  558. Procedure T_REQUEST[TITLE$]
  559.    
  560.    ' This procedure displays an Interface requester centred on-screen 
  561.    ' The title for the requester is passed as TITLE$ and the procedure
  562.    ' returns the text input from an Interface EDit zone 
  563.    
  564.    ' EXAMPLE: REQUEST["Please enter some text"] 
  565.    
  566.    ' Interface Program
  567.    
  568.    IN_STRING$=IN_STRING$+"BAse     80,40;"
  569.    IN_STRING$=IN_STRING$+"SIze     1VATextWidth32+,TextHeight6*;"
  570.    IN_STRING$=IN_STRING$+"BAse     ScreenWidth SizeX-2/,ScreenHeight SizeY-2/;"
  571.    IN_STRING$=IN_STRING$+"SAve     1;"
  572.    IN_STRING$=IN_STRING$+"BOx      0,0,67,SizeX,SizeY;"
  573.    IN_STRING$=IN_STRING$+"POutline 1VACentreX,10,1VA,0,3;"
  574.    IN_STRING$=IN_STRING$+"ED       1,16,32,2VA,30,'',0,3 ;"
  575.    IN_STRING$=IN_STRING$+"EXit;"
  576.    
  577.    
  578.    ' Open Communication Channel between Amos and Interface program
  579.    Dialog Open 4,IN_STRING$
  580.    
  581.    ' Pass title string to Interface 
  582.    TITLE$=" "+TITLE$
  583.    TITLE$=TITLE$+" "
  584.    Vdialog$(4,1)=TITLE$
  585.    Vdialog(4,2)=Len(TITLE$)
  586.    
  587.    ' Call GET_STRING$ program 
  588.    X=Dialog Run(4)
  589.    
  590.    ' Wait for input complete
  591.    Repeat 
  592.       ' RET$ is returned by the procedure to Amos
  593.       RET$=Rdialog$(4,1)
  594.    Until Dialog(4)
  595.    
  596.    ' Close Interface program
  597.    Dialog Close(4)
  598.    
  599. End Proc[RET$]
  600.  
  601. Procedure SH0W_RECORD[SEARCH_NAME$,FOUND_NUM$,TITLE$]
  602.    
  603.    ' Interface Program
  604.    A$=""
  605.    A$=A$+"BAse     100,70 ;"
  606.    A$=A$+"SIze     384,100 ;"
  607.    A$=A$+"SAve     1 ;"
  608.    A$=A$+"BOx      0,0,67,384,100 ;"
  609.    A$=A$+"SetVar   1,'Record Details' ;"
  610.    A$=A$+"SetVar   2,'Name:' ;"
  611.    A$=A$+"SetVar   3,'Tel.:' ;"
  612.    
  613.    ' Title    
  614.    A$=A$+"LIne     48,24,31,336 ;"
  615.    A$=A$+"POutline 1VACentreX,10,1VA,0,3 ;"
  616.    A$=A$+"LIne     48,40,31,336 ;"
  617.    
  618.    ' Record Number
  619.    A$=A$+"POutline 6VACentreX,30,6VA,0,3 ;"
  620.    
  621.    ' Name Gadget
  622.    A$=A$+"POutline 18,50,2VA,0,3 ;"
  623.    A$=A$+"POutline 70,50,4VA,0,3 ;"
  624.    
  625.    ' Number Gadget
  626.    A$=A$+"POutline 18,70,3VA,0,3 ;"
  627.    A$=A$+"POutline 70,70,5VA,0,3 ;"
  628.    
  629.    'A$=A$+"BUtton   3,346,80,32,16,0,0,1;[UN 0,0,16;][ButtonQuit;]" 
  630.    
  631.    A$=A$+"RUn      0,%1111;"
  632.    A$=A$+"EXit;"
  633.    
  634.    ' Open Communication Channel between Amos and Interface program
  635.    Dialog Open 5,A$
  636.    
  637.    ' Send defaults to Interface 
  638.    Vdialog$(5,4)=SEARCH_NAME$
  639.    Vdialog$(5,5)=FOUND_NUM$
  640.    Vdialog$(5,6)=TITLE$
  641.    
  642.    ' Call Interface Program 
  643.    X=Dialog Run(5)
  644.    
  645.    ' Close Interface program
  646.    Dialog Close(5)
  647.    
  648. End Proc
  649.  
  650. Procedure MESSAGE[MESSAGE$,DELAY]
  651.    ' Interface Program
  652.    
  653.    A$=A$+"BAse     80,40;"
  654.    A$=A$+"SIze     1VATextWidth32+,TextHeight4*;"
  655.    A$=A$+"BAse     ScreenWidth SizeX-2/,ScreenHeight SizeY-2/;"
  656.    A$=A$+"SAve     1;"
  657.    A$=A$+"BOx      0,0,67,SizeX,SizeY;"
  658.    A$=A$+"POutline 1VACentreX,12,1VA,0,3;"
  659.    A$=A$+"RUn      2VA, %1111;"
  660.    A$=A$+"EXit;"
  661.    
  662.    
  663.    ' Open Communication Channel between Amos and Interface program
  664.    Dialog Open 1,A$
  665.    
  666.    ' Pass title string to Interface 
  667.    MESSAGE$=" "+MESSAGE$
  668.    MESSAGE$=MESSAGE$+" "
  669.    Vdialog$(1,1)=MESSAGE$
  670.    Vdialog(1,2)=DELAY
  671.    
  672.    
  673.    ' Call GET_STRING$ program 
  674.    X=Dialog Run(1)
  675.    
  676.    ' Close Interface program
  677.    Dialog Close(1)
  678.    
  679. End Proc
  680.  
  681. Procedure TERMINATE
  682.    Shared NAME$(),NUMBER$(),CHANGE_DATA
  683.    
  684.    If CHANGE_DATA
  685.       ' Save Data to File
  686.       ' =================
  687.       Open Random 1,"Phone.dat"
  688.       Field 1,50 As OUT_NAME$,20 As OUT_NUM$
  689.       
  690.       OUT_NAME$="START OF FILE"
  691.       OUT_NUM$=Str$(MARK_END)
  692.       Put 1,1
  693.       
  694.       For RECORD=2 To MARK_END+1
  695.          OUT_NAME$=NAME$(RECORD-1)
  696.          OUT_NUM$=NUMBER$(RECORD-1)
  697.          Put 1,RECORD
  698.       Next RECORD
  699.       
  700.       Close(1)
  701.       
  702.       MESSAGE["Data Saved",150]
  703.    End If 
  704.    
  705. End Proc